<ul>
    <?php
    
    foreach ($dirpathapps as $containername) :
        ?>
        <li>
            <?php
            echo jq_link_to_remote($containername['name'].' >', array(
                'url' => '',
                'complete' => 'mostraNivel(\''.$containername['name'].'li\')'
            ))
            ?>
            <ul id="<?php echo $containername['name'] ?>li" style="display: <?php if($conteiner == $containername['name']): ?>block<?php else : ?>none<?php endif;?>">
                <?php
                foreach ($containername['aplicacoes'] as $dirname) :
                    ?>
                    <li>
                        <?php
                        echo jq_link_to_remote($dirname['name'], array(
                            'url' => '',
                            'complete' => 'mostraNivel(\'' . $dirname['name'] . 'li\')'
                        ))
                        ?>
                        <ul id="<?php echo $dirname['name'] ?>li" style="display: <?php if($aplicacao == $dirname['name']): ?>block<?php else : ?>none<?php endif;?>">
                            <?php
                            foreach ($dirname['modules'] as $subdirname) :
                                ?>
                                <li>
                                    <?php
                                    echo jq_link_to_remote($subdirname['name'], array(
                                        'url' => '',
                                        'complete' => 'setCaminho(\'' . $subdirname['caminho'] . '\')'
                                    ))
                                    ?>
                                </li>
                                <?php
                            endforeach;
                            ?>
                        </ul>
                    </li>
                    <?php
                endforeach;
                ?>
            </ul>
        </li>
        <?php
    endforeach;
    ?>
</ul>